import React, { FC, useContext } from 'react';
import { Row } from 'antd';
import AntdCol from '../AntdCol';
import { DesignRedux } from '../../DesignRedux';
import { getDashed } from '../../utils';

const AntdRow: FC = (props: any) => {
  const { schema } = props;
  const { globalState } = useContext(DesignRedux);
  const { rightNode } = globalState;

  // 获取样式
  let clazz = getDashed(rightNode, schema);

  return (
    <Row className={clazz}>
      {schema.children.map((sItem: any, index: any) => {
        return <AntdCol schema={sItem} key={index.toString()} />;
      })}
    </Row>
  );
};
export default AntdRow;
